/**
 * @title  contract deploy
 */
const { devlopmentChains, chainConfig } = require("../helper-hardhat-config")
const { network, ethers } = require("hardhat")
const { verifyContract } = require("../utils/verify")

module.exports = async (hre) => {
    const { getNamedAccounts, deployments } = hre
    const { deploy, log } = deployments
    const { deployer } = await getNamedAccounts() //获取部署合约的地址

    const args = []
    const NFTSHOP = await deploy("NFTSHOP", {
        from: deployer,
        args: args,
        log: true,
        // @ts-ignore
        waitConfirmations: network.config.blockConfirmations || 1,
    })
    //校验合约代码
    if (
        !devlopmentChains.includes(network.name) &&
        process.env.ETHERSCAN_API_KEY
    ) {
        console.log("verifying contract")
        await verifyContract(NFTSHOP.address, args)
    }
}
module.exports.tags = ["nftshop", "all"]
